package com.clkj.xiuzheng.dao.shangcheng;

import com.clkj.xiuzheng.pojo.shangcheng.Operator;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface ScOperatorMapper extends Mapper<Operator> {
    @Select({"<script>",
            "select o.*, i.identity_name as identityName from t_xz_operator o left join t_xz_identity i on i.identity_id = o.identity_id  ",
            "where 1=1",
            "<if test='companyId != null'>",
            "and  o.company_id = #{companyId}",
            "</if>",
            "<if test='operatorName != null'>",
            "and  o.operator_name like '%${operatorName}%' ",
            "</if>",
            "<if test='createTime != null'>",
            "and  o.create_time &gt; = #{createTime}",
           "</if>",
            "<if test='endTime != null'>",
            "and  o.create_time &lt; = #{endTime}",
            "</if>",
            "</script>"
            })
    List<Operator> getOperatorList(@Param("companyId") Integer companyId, @Param("operatorName") String operatorName, @Param("createTime") String createTime, @Param("endTime") String endTime);
    @Select("SELECT ii.menu_id FROM t_xz_operator op  left join t_xz_identity  id on op.identity_id=id.identity_id LEFT JOIN t_xz_identityInfo ii on id.identity_id = ii.identity_id where op.operator_id = #{operatorId}")
    Integer[] selectMenuById(Integer operatorId);
}
